package com.youyi.yyfilepickerlibrary.core.adapter;

import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.lkx.liandianqinew.R;
import com.youyi.yyfilepickerlibrary.core.SelectOptions;
import com.youyi.yyfilepickerlibrary.core.model.EssFile;
import com.youyi.yyfilepickerlibrary.core.util.UiUtils;
import java.util.List;

public class EssMediaAdapter extends BaseQuickAdapter<EssFile, BaseViewHolder> {
    private int mImageResize;

    public EssMediaAdapter(List<EssFile> list) {
        super(R.layout.ess_media_item, list);
    }

    public void setImageResize(int i) {
        this.mImageResize = i;
    }

    /* access modifiers changed from: protected */
    public void convert(BaseViewHolder baseViewHolder, EssFile essFile) {
        if (essFile.getItemType() == 0) {
            baseViewHolder.getView(R.id.media).setVisibility(View.GONE);
            baseViewHolder.getView(R.id.capture).setVisibility(View.VISIBLE);
            baseViewHolder.itemView.setLayoutParams(new ViewGroup.LayoutParams(this.mImageResize - UiUtils.dpToPx(this.mContext, 4.0f), this.mImageResize));
            baseViewHolder.addOnClickListener(R.id.capture);
            return;
        }
        baseViewHolder.getView(R.id.capture).setVisibility(View.GONE);
        baseViewHolder.getView(R.id.media).setVisibility(View.VISIBLE);
        baseViewHolder.itemView.setLayoutParams(new ViewGroup.LayoutParams(-2, this.mImageResize));
        ImageView imageView = (ImageView) baseViewHolder.getView(R.id.media_thumbnail);
        RequestOptions centerCrop = new RequestOptions().centerCrop();
        int i = this.mImageResize;
        Glide.with(this.mContext).load(essFile.getUri()).apply(centerCrop.override(i, i).placeholder(SelectOptions.getInstance().placeHolder == null ? this.mContext.getResources().getDrawable(R.mipmap.png_holder) : SelectOptions.getInstance().placeHolder)).into(imageView);
        if (SelectOptions.getInstance().isSingle || SelectOptions.getInstance().maxCount == 1) {
            baseViewHolder.setVisible(R.id.check_view, false);
            return;
        }
        ImageView imageView2 = (ImageView) baseViewHolder.getView(R.id.check_view);
        baseViewHolder.setVisible(R.id.check_view, true);
        baseViewHolder.addOnClickListener(R.id.check_view);
        baseViewHolder.addOnClickListener(R.id.media_thumbnail);
        if (essFile.isChecked()) {
            Glide.with(this.mContext).load(Integer.valueOf(R.drawable._img_chose)).into(imageView2);
        } else {
            Glide.with(this.mContext).load(Integer.valueOf(R.drawable._img_unchose)).into(imageView2);
        }
    }
}
